package com.qingluan.widget;

import com.qingluan.dd.R;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;

public class DetailInfoFactoryActivity extends Activity {
	public static final String DETAIL_INFO = "detail_info";
	public static final String ACCESS_NUM = "access_num";
	
	//widget arguments area
	private EditText editable;
	private EditText edit_access_num;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_detail_info_factory);
		editable = (EditText)findViewById(R.id.edit_detail_info);
		edit_access_num = (EditText)findViewById(R.id.edit_access_num);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.detail_info_factory, menu);
		return true;
	}
	
	public void Commit(View v){
		String  info = editable.getText().toString();
		
		String num  =  edit_access_num.getText().toString();
		if(num.length() <1 ){
			edit_access_num.requestFocus();
		}
		
		if (info.length() <= 5){
			editable.requestFocus();
		}else {
			Intent intent = getIntent();
			intent.putExtra("detail_info", info);
			intent.putExtra("access_num", num);
			this.setResult(RESULT_OK, intent);
			this.finish();
		}
		
		
		
	}

}
